
namespace FastFood.Business.Logic
{
	using System;
	using System.Collections.Generic;
	using EDOSwit.Entity;
	using FastFood.Business.Entities;
	using FastFood.DataAccess;
    using System.Linq;

	/// <summary>
	/// Represents the Manager of Almacenes.
	/// </summary>
	[Serializable]
	public class AlmacenesManager : Singleton<AlmacenesManager>
	{
		#region Methods

		/// <summary>
		/// Selects all records from the Almacenes table.
		/// </summary>
		public IList<Almacenes> Listar()
		{
			try
			{
                return AlmacenesData.Instancia.Listar().Reverse().ToList();
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Selects a single record from the Almacenes table.
		/// </summary>
		public Almacenes Obtener(short almacenID)
		{
			try
			{
				return AlmacenesData.Instancia.Obtener(almacenID);
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Saves a record to the Almacenes table.
		/// </summary>
		public int Agregar(Almacenes almacenes)
		{
			try
			{
				return AlmacenesData.Instancia.Agregar(almacenes);
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Updates a record in the Almacenes table.
		/// </summary>
		public bool Modificar(Almacenes almacenes)
		{
			try
			{
				return AlmacenesData.Instancia.Modificar(almacenes);
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Deletes a record from the Almacenes table by its primary key.
		/// </summary>
		public bool Eliminar(short almacenID)
		{
			try
			{
				return AlmacenesData.Instancia.Eliminar(almacenID);
			}
			catch (Exception) { throw; }
		}

		#endregion
	}
}
